.TH std::integral 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::integral \- std::integral

.SH Synopsis
   Defined in header <concepts>
   template< class T >                        \fI(since C++20)\fP
   concept integral = std::is_integral_v<T>;

   The concept integral<T> is satisfied if and only if T is an integral type.

.SH Example


// Run this code

 #include <concepts>
 #include <iostream>

 void print(std::integral auto i)
 {
     std::cout << "Integral: " << i << '\\n';
 }

 void print(auto x)
 {
     std::cout << "Non-integral: " << x << '\\n';
 }

 int main()
 {
     std::cout << std::boolalpha;

     static_assert(std::integral<bool>);
     print(true);

     static_assert(std::integral<char>);
     print('o');

     static_assert(std::integral<int>);
     print(007);

     static_assert( ! std::integral<double> );
     print(2e2);

     static_assert( ! std::integral<decltype("")> );
     print("∫∫∫");
 }

.SH Output:

 Integral: true
 Integral: o
 Integral: 7
 Non-integral: 200
 Non-integral: ∫∫∫

.SH See also

   is_integral checks if a type is an integral type
   \fI(C++11)\fP     \fI(class template)\fP
